package com.atguigu.crowd.api;

import com.atguigu.crowd.util.ResultEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

@FeignClient(value = "com.atguigu-crowd-redis")
public interface RedisRemoteService {

    @RequestMapping("/set/Redis/Key/Value/Remote")
    ResultEntity<String> setRedisKeyValueRemote(
            @RequestParam("key") String key,
            @RequestParam("value") String value);

    //设置带超时时间的
    @RequestMapping("/set/Redis/Key/Value/Remote/With/Timeout")
    ResultEntity<String> setRedisKeyValueRemoteWithTimeout(
            @RequestParam("key") String key,
            @RequestParam("value") String value,
            @RequestParam("time")long time,
            @RequestParam("timeUnit")TimeUnit timeUnit);

    @RequestMapping("/get/Redis/String/Value/By/Key")
    ResultEntity<String> getRedisStringValueByKey(@RequestParam("key") String key);


    @RequestMapping("/remove/Redis/Key/Remote")
    ResultEntity<String> removeRedisKeyRemote(@RequestParam("key") String key);

}
